package concurrency2;

import java.util.stream.IntStream;

public class ThreadPriorityDemo {

    public static void main(String[] args) {

        Runnable target = () -> System.out.printf("当前线程是：%s, 优先级：%d%n",
                Thread.currentThread().getName(),
                Thread.currentThread().getPriority()
        );

        IntStream.range(1, 10).forEach(i -> {
            Thread t = new Thread(target);
            t.setPriority(i);
            t.start();
        });
    }
}
